#include "counterthread.h"

#include <pthread.h>
#include <iostream>

using namespace std;

void* counterThread(void* args) {
    ThreadData d = *(ThreadData*) args;

    for (int i = 0; i < d.max; i++) {
        cout << d.name << ": " << i << endl;
        usleep(1000 * d.delay);
    }

    int* i = new int;
    *i = d.max;

    return i;
}
